package com.nbsaas.boot;

import org.mindrot.jbcrypt.BCrypt;

public class BCryptExample {
    public static void main(String[] args) {
        String password = "mySecurePassword";

        // 生成哈希（12 是 cost factor，可调）
        String hashed = BCrypt.hashpw(password, BCrypt.gensalt(12));
        System.out.println("存储哈希: " + hashed);
        System.out.println(BCrypt.gensalt(12));

        // 校验密码
        boolean match = BCrypt.checkpw(password, hashed);
        System.out.println("密码匹配: " + match);
    }
}
